package com.nervenets.shopping.hibernate.domain.user;

import com.nervenets.general.adapter.jsonType.StringArrayJson;
import com.nervenets.general.hibernate.DomainObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.Type;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.List;

@Entity
@Table
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class RoleGroup extends DomainObject {
    @ApiModelProperty(value = "名称")
    @Column(columnDefinition = "varchar(20)")
    private String name;
    @ApiModelProperty(value = "描述")
    @Column(columnDefinition = "varchar(50)")
    private String detail;
    @ApiModelProperty(value = "权限ID")
    @Type(type = StringArrayJson.NAME)
    @Column(columnDefinition = "json")
    private List<String> roles;
    @ApiModelProperty(value = "是否启用")
    @Builder.Default
    private boolean enable = true;
    @ApiModelProperty(value = "排序值，值越大越靠前")
    private int queue;
    @ApiModelProperty(value = "更新时间")
    private long updateTime;
    @ApiModelProperty(value = "父级ID")
    private long parentId;
}
